using System;
using System.Collections.Generic;
using UnityEngine;

public class LeaderBoardStarsStorage
{
	private const string LEADER_BOARD_STARS_STORAGE = "LeaderBoardStarsStorage";

	private static LeaderBoardStarsStorage instance;

	private Dictionary<TypeGame, int> _stars = new Dictionary<TypeGame, int>();

	private LeaderBoardStarsStorage()
	{
	}

	public static LeaderBoardStarsStorage GetInstance()
	{
		if (instance == null)
		{
			instance = new LeaderBoardStarsStorage();
		}
		return instance;
	}

	public void AddStars(TypeGame typeGame, int stars)
	{
		PlayerPrefs.SetInt(GetKey(typeGame), GetStarsByTypeGame(typeGame) + stars);
	}

	public int GetStarsByTypeGame(TypeGame typeGame)
	{
		return PlayerPrefs.GetInt(GetKey(typeGame));
	}

	public int GetAllStars()
	{
		int num = 0;
		foreach (object value in Enum.GetValues(typeof(TypeGame)))
		{
			num += GetStarsByTypeGame((TypeGame)(int)value);
		}
		return num;
	}

	public void Reset()
	{
		foreach (object value in Enum.GetValues(typeof(TypeGame)))
		{
			PlayerPrefs.SetInt(GetKey((TypeGame)(int)value), 0);
		}
	}

	private string GetKey(TypeGame typeGame)
	{
		return "LeaderBoardStarsStorage" + typeGame;
	}
}
